/**
 * 希尔排序：平分和插入的思想
 * @param {*} arr
 */
function shellSort(arr) {
  let len = arr.length
  let gay = len
  let temp = null
  while (true) {
    gay = Math.ceil(gay / 2)
    for (let i = 0; i < len - gay; i++) {
      if (arr[i + gay] < arr[i]) {
        temp = arr[i]
        arr[i] = arr[i + gay]
        arr[i + gay] = temp
        temp = null
      }
    }
    console.log('量', gay)

    if (gay === 1) {
      break
    }
  }
  return arr
}
console.log(shellSort([1, 2, 5, 7, 8, 0, 9]))
